package plenprojects.security;

public class Permission {
	
	private String chatroom;
	private PermissionType type;
	
	public Permission(String chatroom, PermissionType type) {
		
		this.chatroom = chatroom;
		this.type = type;
	}

	public String getChatroom() {
		
		return chatroom;
	}

	public PermissionType getType() {
		
		return type;
	}

	@Override
	public int hashCode() {
		
		final int prime = 31;
		int result = 1;
		result = prime * result
				+ ((chatroom == null) ? 0 : chatroom.hashCode());
		result = prime * result + ((type == null) ? 0 : type.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Permission other = (Permission) obj;
		if (chatroom == null) {
			if (other.chatroom != null)
				return false;
		} else if (!chatroom.equals(other.chatroom))
			return false;
		if (type != other.type)
			return false;
		return true;
	}
	
}
